<div>
  <!-- 按钮 -->
  <el-button type="success" plain @click="showAddCatDialog">添加分类</el-button>
  <!-- 表格 -->
  <el-table v-loading="loading" :data="categoriesList" style="width: 100%">
    <el-table-tree-column
      file-icon="icon icon-file"
      folder-icon="icon icon-folder"
      prop="cat_name"
      label="分类名称"
      width="180"
      tree-key="cat_id"
      parent-key="cat_pid"
      level-key="cat_level"
      :indent-size="30"
    ></el-table-tree-column>
    <!-- <el-table-column prop="cat_name" label="分类名称" width="180">
    </el-table-column> -->
    <el-table-column prop="cat_deleted" label="是否有效" width="180">
      <template slot-scope="scope">
        <div>{{ scope.row.cat_deleted == false ? '是' : '否' }}</div>
      </template>
    </el-table-column>
    <el-table-column prop="cat_level" label="层级"> </el-table-column>
    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          type="primary"
          plain
          icon="el-icon-edit"
        ></el-button>
        <el-button
          size="mini"
          type="danger"
          plain
          icon="el-icon-delete"
        ></el-button>
      </template>
    </el-table-column>
  </el-table>
  <!-- 分頁 -->
  <el-pagination
    @current-change="pageChange"
    background
    layout="prev, pager, next"
    :page-size="4"
    :total="total"
  >
  </el-pagination>

  <!-- 添加分类对话框 -->
  <el-dialog title="添加分类" :visible.sync="isDialogAddCatVisiable">
    <el-form :model="cateForm" label-width="80px">
      <el-form-item label="分类名称">
        <el-input v-model="cateForm.cat_name"></el-input>
      </el-form-item>
      <el-form-item label="父级名称">
        <el-cascader
          v-model="cateForm.cat_pid_arr"
          :props="{ label : 'cat_name', value:'cat_id' }"
          :options="options"
          change-on-select
        ></el-cascader>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="isDialogAddCatVisiable = false">取 消</el-button>
      <el-button type="primary" @click="addCate">确 定</el-button>
    </div>
  </el-dialog>
</div>
